home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
C64
/
T-TPUG Old Monthly Disks
/
(c)t3.d64
/
column calc.c
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2007-02-04
|
6KB
|
254 lines
5 REM"ADAPTED BY STEVEN DARNOLD, P.O. BOX 201 ALEXANDRA, NEW ZEALAND
8 [151]53280,6:[151]53281,6
9 [134]V(15,60),X$(50),V$(15,60):CR$[178]"LOAD":CT$[178]"OPEN ******* CALCULATING *******CONT"
10 [153]"RETURNLOADOPENC O L U M N C A L C U L A T O R":C%[178]1:R%[178]1
20 [153]"CONT VCONTIEW COLUMNS
30 PRINT" E[154]NTER DATA
40 [153]" DCONTO CALCULATIONS
50 PRINT" Z[154]ERO MATRIX
60 [153]" GCONTET DATA FROM TAPE
70 PRINT" S[154]AVE DATA ON TAPE
80 [153]" MCONTEMORY CHECK
85 PRINT" P[154]RINT DATA ON PRINTER"
95 PRINT"[159]WHAT IS YOUR CHOICE ?":Y=0
96 GETAN$:IFAN$=""THEN96
97 FORX=1TO8:IFAN$=MID$("VEDZGSMP",X,1)THENY=X
98 NEXT:ONYGOSUB230,1000,2020,120,702,802,940,12010:GOTO10
120 PRINTCR$:FORX=1TO15
130 FORY=1TO50
140 V(X,Y)=0
150 NEXTY
160 NEXTX
165 RETURN
190 INPUT"[147]ENTER COLUMN (1 TO 13):";C%
200 IFC%<1ORC%>13THENPRINT"[147]";:GOTO190
210 PRINT:INPUT"ENTER ROW (1 TO 31):";R%
220 IFR%<1ORR%>31THEN210
230 PRINT"[147]";:GOSUB500
240 PRINT"";
250 FORY=R%TOR%+19
260 PRINTTAB(9);
270 FORX=C%TOC%+2
280 X$=STR$(V(X,Y))
290 PRINTSPC(10-LEN(X$));X$;
300 NEXT
310 PRINTCHR$(13);
320 NEXT
325 PRINT" ";
330 PRINT"U[154]P D[154]OWN L[154]EFT R[154]IGHT J[154]UMP M[154]ENU";
340 GETC$:IFC$=""THEN340
360 IFC$="U"THENR%=R%-10:PRINTCHR$(13);"";:GOTO220
380 IFC$="D"THENR%=R%+10:PRINTCHR$(13);"";:GOTO220
400 IFC$="L"THENC%=C%-2:GOTO470
420 IFC$="R"THENC%=C%+2:GOTO470
440 IFC$="J"THEN190
450 IFC$="M"THEN10
460 GOTO340
470 IFC%<1ORC%>13THENPRINTCHR$(13);:GOTO190
480 GOTO230
500 PRINTTAB(9);
510 FORI=1TO3
520 PRINT"[154] COLUMN[146]";
530 NEXT
540 PRINTCHR$(13);TAB(9);
550 FORI=C%TOC%+2
560 S%=7:IFI<10THENS%=8
570 PRINTSPC(S%);"";STR$(I);"[146]";
580 NEXT
590 PRINTCHR$(13);
600 FORI=R%TOR%+19
610 S$="":IFI<10THENS$=" "
620 PRINTTAB(2);"[154]ROW"S$STR$(I);"[146][159]"
630 NEXT
640 RETURN
702 INPUT"[147]WHAT IS NAME OF FILE YOU WANT";FL$
710 PRINT"[147]LOOKING FOR ";FL$
720 OPEN1,1,0,(FL$)
725 PRINT"FOUND ";FL$;" .....LOADING"
730 FORX=1TO12
740 FORY=1TO49
750 INPUT#1,V(X,Y)
760 NEXTY
770 NEXTX
780 (null)#1:PRINT"OK.....GOT DATA"
790 FORI=1TO1000:NEXTI
795 RETURN
802 INPUT"[147]WHAT NAME FOR THIS FILE";FL$
840 OPEN1,1,1,(FL$)
850 FORX=1TO12
860 FORY=1TO49
870 PRINT#1,V(X,Y)
880 NEXTY
890 NEXTX
900 (null)#1:PRINT"OK.....DATA ON TAPE"
910 FORI=1TO1000:NEXTI
920 RETURN
940 PRINT" "FRE(A)"BYTES FREE
950 [129]I[178]1[164]1000:[130]I
960 [142]
1000 [153]"LOAD":[153]
1010 [133]"WHICH COLUMN (1-12)";K$
1020 CL[178][197](K$):[139]CL[179]1[176]CL[177]12[167]1000
1030 [139]CL[178]13[176]CL[178]14[176]CL[178]15[167][153]"RESERVED FOR TOTALS":[137]1010
1040 [133]"HOW MANY ROWS (1-50)";K$
1050 K[178][197](K$):[139]K[177]50[176]K[179]1[167]1040
1060 [153]:[153]"ROW","CURRENT","COLUMN";CL
1070 [129]Y[178]1[164]K
1080 [153]:[153]Y,V(CL,Y),:[133]"CMDCMDCMDCMDCMDCMDCMDCMDCMDCMDCMD";V:V(CL,Y)[178]V
1090 [130]Y
1100 [153]"CCONT FOR ANOTHER COLUMN MCONT FOR MENU
1110 GETD$:IFD$=""THEN1110
1120 IFD$="C"THEN1000
1130 RETURN
2020 PRINT"[147][159]YOU MAY CHOOSE ANY OF THE FOLLOWING"
2030 PRINT" 1[154] SUM DOWN COLUMNS
2040 [153]" 2CONT SUM ACROSS ROWS
2050 PRINT" 3[154] REPRODUCE ANY COLUMN
2060 [153]" 4CONT ADD-MULT-DIV-SUB AT ANY POINT
2070 PRINT" 5[154] AVERAGE ACROSS ROWS (DO 2[146] FIRST)
2080 [153]" 6CONT MAKE ROW % OF BASE ROW
2090 PRINT" 7[154] MAKE COLUMN % OF BASE COLUMN
2100 [153]" 8CONT SUM INDIVIDUAL COLUMNS
2110 PRINT" 9[154] SERIES OF CALCULATIONS
2120 [153]" MCONT RETURN TO MENU
2121 PRINT"[159] [163][163][163][163][163][163] [163][163] [163][163][163][163]
3500 [153]"WHICH ONE ?";
3510 [146]198,7:[161]AN$:[139]AN$[178]""[167]3510
3515 [139]AN$[178]"M"[167][142]
3520 [145][197](AN$)[141]4001,5010,6010,7010,8010,9010,10010,11010,11510
3530 [137]2020
4001 [153]"LOADDO YOU WISH TO DESIGNATE THE ROWS TO BE SUMMED?"
4002 [161]A$:[139]A$[178]""[167]4002
4003 [139]A$[178]"N"[167]S1[178]1:S2[178]49:[137]4005
4004 [133]"FIRST ROW";S1:[133]"LAST ROW";S2:[139]S1[177]S2[176]S1[179]0[176]S2[177]49[167]4001
4005 [153]CR$;CT$:[153]"SUM WILL BE STORED IN ROW"S2[170]1
4010 [129]X[178]1[164]14
4020 V(X,S2[170]1)[178]0
4030 [130]X
4040 [129]X[178]1[164]14
4050 [129]Y[178]S1[164]S2
4060 V(X,S2[170]1)[178]V(X,S2[170]1)[170]V(X,Y)
4070 [130]Y
4080 [130]X
4090 [142]
5010 [153]CR$;CT$:[153]"SUM WILL BE STORED IN COLUMN 13
5020 FORY=1TO48
5030 V(13,Y)=0
5040 NEXTY
5050 FORY=1TO48
5060 FORX=1TO12
5070 V(13,Y)=V(13,Y)+V(X,Y)
5080 NEXTX
5090 NEXTY
5100 RETURN
6010 INPUT"[147]DUPLICATE WHICH COLUMN";CX
6015 INPUT"PUT IT IN WHICH COLUMN";X
6030 FORY=1TO50
6040 V(X,Y)=V(CX,Y)
6050 NEXTY
6060 RETURN
7010 Y=0
7020 PRINT"[147]A[146]DD M[146]ULTIPLY S[146]UBTRACT D[146]IVIDE
7030 [161]A$:[139]A$[178]""[167]7030
7040 [129]X[178]1[164]4:[139]A$[178][202]("AMSD",X,1)[167]Y[178]X
7050 [130]:[145]Y[137]7070,7130,7190,7250:[137]7030
7070 [133]"LOADAMOUNT TO ADD";AD
7080 [133]"WHAT COL #";X
7090 [133]"WHAT ROW #";Y
7100 V(X,Y)[178]V(X,Y)[170]AD
7110 [137]7999
7130 [133]"LOADAMOUNT TO MULTIPLY BY";ML
7140 [133]"WHAT COL #";X
7150 [133]"WHAT ROW #";Y
7160 V(X,Y)[178]V(X,Y)[172]ML
7170 [137]7999
7190 [133]"LOADAMOUNT TO SUBTRACT";SB
7200 [133]"WHAT COL #";X
7210 [133]"WHAT ROW #";Y
7220 V(X,Y)[178]V(X,Y)[171]SB
7230 [137]7999
7250 [133]"LOADAMOUNT TO DIVIDE BY";DV
7260 [133]"WHAT COL #";X
7270 [133]"WHAT ROW #";Y
7280 V(X,Y)[178]V(X,Y)[173]DV
7290 V(X,Y)[178][181](V(X,Y)[172]1000[170].5)[173]1000
7300 [137]7999
7999 [142]
8010 [133]"LOADHOW MANY ITEMS IN EACH ROW";AVE
8020 [153]CR$;CT$:[153]"AVERAGE WILL BE STORED IN COLUMN 14
8030 FORY=1TO50
8035 IFV(13,Y)=0THEN8050
8040 V(14,Y)=V(13,Y)/AVE:V(14,Y)=INT(V(14,Y)*1000+.5)/1000
8050 NEXTY
8060 RETURN
9010 INPUT"[147]WHICH IS BASE ROW";BR
9020 INPUT"WHICH IS ROW FOR PERCENTAGES";Y:IFBR=YTHENRETURN
9030 FORX=1TO13
9055 IFV(X,BR)=0THEN9075
9060 V(X,Y)=V(X,Y)/V(X,BR):V(X,Y)=INT(V(X,Y)*10000+.5)/100
9075 NEXTX
9080 RETURN
10010 INPUT"[147]WHICH IS BASE COLUMN";CX
10020 INPUT"WHICH IS COLUMN FOR PERCENTAGES";X:IFX=CXTHENRETURN
10030 FORY=1TO50
10055 IFV(CX,Y)=0THEN10075
10060 V(X,Y)=V(X,Y)/V(CX,Y):V(X,Y)=INT(V(X,Y)*10000+.5)/100
10075 NEXTY
10080 RETURN
11010 PRINT"[147]WHICH COLUMN DO YOU WANT TO SUM";
11020 INPUTCA:IFCA<1ORCA>15THEN11020
11030 PRINT"W[146]HOLE COLUMN OR P[146]ART OF COLUMN?"
11040 GETYN$:IFYN$<>"P"ANDYN$<>"W"THEN11040
11050 IFYN$="P"THENGOSUB11210:GOTO11065
11060 S1=1:S2=49
11065 V(CA,S2+1)=0
11070 FORY=S1TOS2
11080 V(CA,S2+1)=V(CA,S2+1)+V(CA,Y)
11090 NEXTY
11100 RETURN
11210 INPUT"ROW OF FIRST ITEM IN THE SUM";S1
11215 INPUT"ROW OF LAST ITEM IN THE SUM";S2:IFS1>S2ORS1<0ORS2>49THEN11210
11220 RETURN
11510 PRINT:PRINT"[145][145][145][145][145][145]HOW MANY CALCULATIONS (1-8)?"
11515 FORI=1TO5:PRINT" ":NEXT
11520 GETNM$:IFNM$=""THEN11520
11525 IFVAL(NM$)<0ORVAL(NM$)>8THEN11520
11530 NM=VAL(NM$):IFNM=0THENRETURN
11540 PRINT"[145][145][145][145][145][145]ENTER OPERATIONS IN THE ORDER YOU WANT THEM TO BE PERFORMED."
11550 FORI=1TONM
11560 PRINT"ENTER OPERATION #"I"[157] [157][157][157][157][157][157][157][157]";
11570 GETA$:OP(I)=VAL(A$):IFOP(I)<1OROP(I)>8THEN11570
11575 PRINTOP(I)
11580 NEXTI
11590 FORI=1TONM
11600 ONOP(I)GOSUB4001,5010,6010,7010,8010,9010,10010,11010
11610 NEXTI
11620 RETURN
12010 PRINT"[147]MAKE SURE PRINTER IS ON.":PRINT"...HIT ANY KEY WHEN READY."
12020 GETA$:IFA$=""THEN12020
12030 PRINT"DO YOU WANT TO DESIGNATE THE ROWS TO BE PRINTED?"
12040 GETA$:IFA$=""THEN12040
12050 IFA$="N"THENS1=1:S2=50:GOTO12070
12060 INPUT"FIRST ROW TO BE PRINTED";S1:INPUT"LAST ROW TO BE PRINTED";S2
12070 SP$=" "
12080 OPEN4,4
12100 PRINT#4," COLUMNS ";:FORI=1TO5:PRINT#4,I;" ";:NEXT
12110 PRINT#4
12120 FORY=S1TOS2
12130 PRINT#4,LEFT$("ROW"+STR$(Y)+SP$,10);
12135 FORI=1TO5:PRINT#4,RIGHT$(SP$+STR$(V(I,Y)),14);:NEXTI:PRINT#4
12140 NEXTY:PRINT#4:PRINT#4
12150 PRINT#4," COLUMNS ";:FORI=6TO10:PRINT#4,I;" ";:NEXT
12155 PRINT#4
12160 FORY=S1TOS2
12170 PRINT#4,LEFT$("ROW"+STR$(Y)+SP$,10);
12175 FORI=6TO10:PRINT#4,RIGHT$(SP$+STR$(V(I,Y)),14);:NEXTI:PRINT#4
12180 NEXTY:PRINT#4:PRINT#4
12190 PRINT#4," COLUMNS ";:FORI=11TO15:PRINT#4,I;" ";:NEXT
12195 PRINT#4
12200 FORY=S1TOS2
12210 PRINT#4,LEFT$("ROW"+STR$(Y)+SP$,10);
12215 FORI=11TO15:PRINT#4,RIGHT$(SP$+STR$(V(I,Y)),14);:NEXTI:PRINT#4
12220 NEXTY
12230 PRINT#4:RETURN